package ${package.ServiceImpl};

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
<#if table.serviceInterface>
import ${package.Service}.${table.serviceName};
</#if>
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wjc.train.common.context.LoginMemberContext;
import com.wjc.train.common.untils.CopyUtil;
import com.wjc.train.${moduleName}.repository.${entity}Repository;
import com.wjc.train.${moduleName}.req.${entity}QueryReq;
import com.wjc.train.${moduleName}.req.${entity}SaveReq;
import com.wjc.train.${moduleName}.resp.${entity}QueryResp;
import jakarta.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Service
public class ${table.serviceImplName}  implements ${table.serviceName} {

    @Resource
    private ${entity}Repository ${lowerEntity}Repository;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void save(${entity}SaveReq ${lowerEntity}SaveReq) {
        ${entity} ${lowerEntity} = CopyUtil.copy(${lowerEntity}SaveReq, ${entity}.class);
        ${lowerEntity}Repository.saveOrUpdate(${lowerEntity});
    }

    @Override
    public IPage<${entity}QueryResp> queryList(IPage<${entity}QueryResp> page, ${entity}QueryReq ${lowerEntity}QueryReq) {
        return ${lowerEntity}Repository.queryList(page,${lowerEntity}QueryReq);
    }

    @Override
    public void delete(Long id) {
        ${lowerEntity}Repository.getBaseMapper().deleteById(id);
    }

}
